home *** CD-ROM | disk | FTP | other *** search
- Path: oxy.rust.net!usenet
- From: ebennett@rust.net
- Newsgroups: comp.lang.c++
- Subject: Re: Floating point overflow
- Date: Thu, 25 Jan 1996 04:01:16 GMT
- Organization: Rust Net - High Speed Internet in Detroit 810-642-2276
- Message-ID: <4e6ko7$ela@oxy.rust.net>
- References: <4dp9g6$spe@sphinx.Gsu.EDU>
- NNTP-Posting-Host: liv-18.rust.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- gs01jpc@panther.Gsu.EDU (J. Patrick Cline) wrote:
-
- >Why would the following bit of code give me a floating point overflow
- >when compiled as a Borland EasyWin target?
-
- >#include <iostream.h>
-
- >double someVar;
-
- >void main() {
- > cout << "Enter a float:";
- > cin >> someVar; // Floating point error occurrs after pressing Enter
- > // Works fine as a DOS app
- >}
-
- Unlike DOS apps, Windows programs (an EasyWin program is actually a
- Windows program) do not zero out static (global) data during startup.
- someVar is starting out with garbage in it, and it is probably not
- recognizable as a valid number.
-
- Counting on C to zero initialize data for you is a poor practice.
-
- Earl Bennett
-
-
-